using UnityEngine;

public class WheelScript : MonoBehaviour
{
	public bool isWheel;

	public WheelJoint2D wheelJoint2D;

	public FixedJoint2D fixedJoint2D;

	private bool breaked;

	private void Awake()
	{
		breaked = false;
	}

	private void Update()
	{
		if (breaked)
		{
			return;
		}
		if (isWheel)
		{
			if (wheelJoint2D == null)
			{
				breaked = true;
				if (SoundScript.Instance != null)
				{
					SoundScript.Instance._playClipBreakVehicle();
					playClip();
				}
				base.transform.SetParent(null);
			}
		}
		else if (fixedJoint2D == null)
		{
			if (SoundScript.Instance != null)
			{
				SoundScript.Instance._playClipBreakVehicle();
				playClip();
			}
			breaked = true;
			base.transform.SetParent(null);
		}
	}

	public bool checkVehibreak()
	{
		return breaked;
	}

	public void playClip()
	{
		GearEffectMan.Instance.play(base.transform.position);
	}
}
